The present invention relates to data protocols, and in particular command protocols for model trains.
A variety of control systems are used to control model trains. In one system, the power to the track is increased, or decreased, to control the speed and direction of the train. Multiple trains can be controlled by providing different power levels to the different sections of the track having different trains (see, e.g., U.S. Pat. No. 5,638,522). In another system, a coded signal is sent along the track, and addressed to the desired train, giving it a speed and direction. The train itself controls its speed by converting the AC voltage on the track into the desired DC motor voltage for the train according to the received instructions. The instructions can also tell the train to turn on or off its lights, horns, etc. U.S. Pat. Nos. 5,749,547 and 5,638,522 issued to Neil Young et al. show such a system. The instructions, or commands, have a particular format for a particular model train manufacturer. Trains already in customer's hands are designed to respond to only that format, limiting the options for future expansion.
The current Lionel Trainmaster command format uses 23 bits to assemble a command. These bits are grouped together as 4 bit nibbles (a nibble is half of an 8 bit byte) and are represented in hexadecimal (hex). The first four nibbles translate directly to the Train Master command set, instructing the train on speed, use of horns, smoke, lights, etc. The fifth nibble is a unique number used to detect errors, an error code. The error code represents the addition of the first four nibbles without a carry. The following is and example of a Train Master Engine 1 horn command.
Old Method00000000100111000101111009C5TrailerEngine 1 Horn(always ones)|command|error|
The error check nibble is calculated by adding 0+0+9+C=15Hex. The upper digit 1 is dropped and the error check nibble becomes 5. The receiver then recovers the first 4 nibbles directly and converts them into Trainmaster Commands. The receiver then looks for a 5 and only a 5 in the fifth nibble position. If a 5 is received the transmission is considered good and is allowed to pass. If a nibble other than 5 is received the message is rejected. The three trailer bits at the end of the message are not used by current receivers for data information. Two bits are used to fill the time until the next command packet, and a third bit is set to offset any DC bias imparted by the combination of bits in the command, as discussed in more detail below.
All of the commands in the current command structure have been used, to both designate a variety of commands and address different trains or other controlled devices on a train set. No new commands are possible, but it would be desirable to add new commands for additional features, and to have the system backward compatible with existing model trains.